两条笔记
ajax 返回并且不继承layout
def edit
@user = current_user
@e =Publisher.new
@video = Video.find(params[:id])
@list = @video.video_files.order('created_at DESC')
gon.test = @video.video_files.order('show_time ASC')
gon.video = @video.mpd_path.to_s
@videoFile = VideoFile.new
@videoFile.video_id = @video.id
@vtt = WebVTT.read(@@vtt_path.to_s + @video.vtt_path.to_s)
gon.vtt = @vtt
respond_to do |format|
format.html {render 'edit',layout:false}
end
end
a标签删除后弹出确认框
一开始以为
删除
function del() {
var msg = “您真的确定要删除吗?请确认!”;
if (confirm(msg)==true){
return true;
}else{
return false;
}
}
然后不管点确认和取消都点击了a的链接
问题在于用onclick 并不能控制a 的执行顺序,需要用on()绑定点击事件
<%= link_to ‘delete’,user_video_com_path(@user.id,c.video_id,c.id),method: :delete,:class=>”dddd” %>
$(“.dddd”).on(‘click’,function(){
var msg = “您真的确定要删除吗?请确认!”;
if (confirm(msg)==true){
return true;
}else{
return false;
}
})